package behavioralpattern.mediatorpattern;
/**
 * 邢帅教育
 * <p>
 * 本源代码由数据中心及其作者共同所有，未经版权持有者的事先书面授权，
 * 不得使用、复制、修改、合并、发布、分发和/或销售本源代码的副本。
 *
 * @copyright Copyright (c) 2018. xsteach.com all rights reserved.
 */

/**
 * @author maikec
 * @date 2018/9/13
 */
public class MediatorDemo {
    public static void main(String[] args) {
        //初始化同事类A
        Colleague colleagueA = new ConcreteColleagueA();
        //初始化同事B
        Colleague colleagueB = new ConcreteColleagueB();

        //初始化同事A1
//        Colleague colleagueA1 = new ConcreteColleagueA();
        //初始化中介类
        Mediator mediator = new ConcreteMediator();
        mediator.register( colleagueA );
        mediator.register( colleagueB );
//        mediator.register( colleagueA1 );
        //A发消息给B
        colleagueA.sendMsg( "Hi,This is A!" );
        //B发消息给A
        colleagueB.sendMsg( "Hi, This is B!" );
        //
//        colleagueA1.sendMsg( "Hi, This is A1!" );

//        a.sendMsg2B("Hi B, This is A!", colleagueB);
//        a.sendMsg2C("Hi C, This is A!", colleagueC);
    }
}
